package scarlett;

import java.io.File;
import java.util.List;
import java.util.regex.Pattern;

/**
 * IScarlettRuntime describes the methods used by all Scarlett programs.  Scarlett source programs
 * are compiled into Jasmin source code.  This Jasmin code describes a Java class which inherits from a ScarlettRuntime
 * object.  The following methods are available to all Scarlett executables.
 */
public interface IScarlettRuntime 
{
	/**
	 * Displays the object to the console
	 * @param o the object to display
	 */
	public  void Show(Object o);
	/**
	 * Given a URI, this method downloads the content and returns it as a string.
	 * @param uri The URI to the content.  Currently only supports http(s):// or file://
	 * @return The content of the resource as a string.
	 */
	public  String GetResourceAsString(String uri);
	/**
	 * Given a URI and a regular expression, this method returns a list of matching strings.
	 * @param uri The URI to the content to scan
	 * @param regEx The pattern to use while scanning.  Each match will be returned.
	 * @return A list of strings matching the provided pattern.
	 */
	public  List<String> Fetch(String uri,Pattern regEx);
	/**
	 * Given a string, this method returns a Java Pattern object.
	 * @param regExpPattern This pattern is compiled into a Java pattern object.
	 * @return the resulting Java pattern.
	 */
	public  Pattern GetPattern(String regExpPattern);
	
	/**
	 * Compares the two arguments and determines if they are equal.
	 * See ScarlettComparator.isSameAs(Object, Object)
	 * @param a
	 * @param b
	 * @return true if the two objects are equal
	 */
	public boolean IsSameAs(Object a, Object b);
	/**
	 * Checks if the first argument is an instance of the second's type.
	 * See ScarlettComparator.isA(Object, Object)
	 * @param a
	 * @param b
	 * @return true if the first argument is an instance of the second's type.
	 */
	public boolean IsA(Object a, Object b);
	/**
	 * Checks if the first argument contains an instance of second argument.
	 * See ScarlettComparator.contains(Object, Object)
	 * @param a
	 * @param b
	 * @return true if the first argument contains an instance of second argument.
	 */
	public boolean Contains(Object a, Object b);
	
	/**
	 * Checks if the first argument is larger than the second argument.
	 * See ScarlettComparator.isLargerThan(Object, Object)
	 * @param a
	 * @param b
	 * @return true if the first argument is larger than the second argument.
	 */
	public boolean IsLargerThan(Object a, Object b);
	/**
	 * Checks if the first argument is smaller than the second argument.
	 * See ScarlettComparator.isSmallerThan(Object, Object)
	 * @param a
	 * @param b
	 * @return true if the first argument is smaller than the second argument.
	 */
	public boolean IsSmallerThan(Object a, Object b);
	/**
	 * Appends input to given file 
	 * @param uri path to file
	 * @param input string to append to file
	 */
	public boolean appendToFile(Object uri, Object input);

}
